home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1997 February / EnigmA AMIGA RUN 15 (1997)(G.R. Edizioni)(IT)[!][issue 1997-02][PLANET CD V].iso / enigma / earcd / sviluppo / svilupp2 / gmsppr10.lha / Sleep.c < prev    next >
C/C++ Source or Header  |  1996-09-22  |  3KB  |  129 lines

  1. #ifndef INTUITION_INTUITIONBASE_H
  2. #include <intuition/intuitionbase.h>
  3. #endif
  4.  
  5. #include <proto/intuition.h>
  6.  
  7. #include "Global.h"
  8.  
  9. /****** gamesupport.library/GS_WindowSleep *******************************
  10. *
  11. *    NAME
  12. *    GS_WindowSleep -- put window to sleep
  13. *
  14. *    SYNOPSIS
  15. *    Success = GS_WindowSleep(Window)
  16. *                              a0
  17. *
  18. *    ULONG GS_WindowSleep(struct Window *);
  19. *
  20. *    FUNCTION
  21. *    Put window to sleep.
  22. *
  23. *    INPUTS
  24. *    Window - the window.
  25. *
  26. *    RESULT
  27. *    Success - TRUE for success (or for a NULL window)
  28. *
  29. *    NOTE
  30. *    There are two possible reasons for failure: not enough memory
  31. *    available to allocate a requester structure, or the maximum
  32. *    number of requesters in the window would be exceeded.
  33. *
  34. *    SEE ALSO
  35. *    GS_WindowWakeup()
  36. *
  37. *************************************************************************/
  38.  
  39. SAVEDS_ASM_A0(ULONG,LibGS_WindowSleep,struct Window *,Window)
  40.  
  41. {
  42.   if (Window!=NULL)
  43.     {
  44.       struct Requester *Requester;
  45.  
  46.       if ((Requester=GS_MemoryAlloc(sizeof(*Requester)))!=NULL)
  47.     {
  48.       InitRequester(Requester);
  49.       Requester->Flags|=NOREQBACKFILL | SIMPLEREQ;
  50.       if (Request(Requester,Window))
  51.         {
  52.           SetWindowPointer(Window,WA_BusyPointer,TRUE,WA_PointerDelay,TRUE,TAG_DONE);
  53.           return TRUE;
  54.         }
  55.       GS_MemoryFree(Requester);
  56.     }
  57.       return FALSE;
  58.     }
  59.   return TRUE;
  60. }
  61.  
  62. /****** gamesupport.library/GS_WindowWakeup ******************************
  63. *
  64. *    NAME
  65. *    GS_WindowWakeup -- wakeup window
  66. *
  67. *    SYNOPSIS
  68. *    GS_WindowWakeup(Window)
  69. *                      a0
  70. *
  71. *    void GS_WindowWakeup(struct Window *);
  72. *
  73. *    FUNCTION
  74. *    Undo the effects of GS_WindowSleep().
  75. *
  76. *    INPUTS
  77. *    Window - the window
  78. *
  79. *    NOTE
  80. *    This function removes the Window->FristRequester requester
  81. *    and GS_MemoryFree()s it. So you better make sure it's not
  82. *    another requester...
  83. *
  84. *************************************************************************/
  85.  
  86. SAVEDS_ASM_A0(void,LibGS_WindowWakeup,struct Window *,Window)
  87.  
  88. {
  89.   if (Window!=NULL)
  90.     {
  91.       struct Requester *Requester;
  92.  
  93.       if ((Requester=Window->FirstRequest)!=NULL)
  94.     {
  95.       EndRequest(Requester,Window);
  96.       ClearPointer(Window);
  97.       GS_MemoryFree(Requester);
  98.     }
  99.     }
  100. }
  101.  
  102. #if 0
  103.       static UWORD __chip BusyPointer[] =
  104.         {
  105.           0x0000, 0x0000,     /* reserved, must be NULL */
  106.  
  107.           0x0400, 0x07C0,
  108.           0x0000, 0x07C0,
  109.           0x0100, 0x0380,
  110.           0x0000, 0x07E0,
  111.           0x07C0, 0x1FF8,
  112.           0x1FF0, 0x3FEC,
  113.           0x3FF8, 0x7FDE,
  114.           0x3FF8, 0x7FBE,
  115.           0x7FFC, 0xFF7F,
  116.           0x7EFC, 0xFFFF,
  117.           0x7FFC, 0xFFFF,
  118.           0x3FF8, 0x7FFE,
  119.           0x3FF8, 0x7FFE,
  120.           0x1FF0, 0x3FFC,
  121.           0x07C0, 0x1FF8,
  122.           0x0000, 0x07E0,
  123.  
  124.           0x0000, 0x0000,     /* reserved, must be NULL */
  125.         };
  126.  
  127.       SetPointer(Window,BusyPointer,16,16,-6,0);
  128. #endif
  129.